package com.holiday.springboot2.controller;


import com.holiday.springboot2.domain.Video;
import com.holiday.springboot2.service.VideoService;
import com.holiday.springboot2.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/video")
public class VideoController {

    @Autowired
    private VideoService videoService;

    @RequestMapping("list")
    public JsonData list() {
        List<Video> videos = videoService.listVideo();
        return JsonData.buildSuccess(videos);
    }

    @PostMapping("save_video")
    public JsonData saveVideo(@RequestBody Video video){
        System.out.println(video);
        return JsonData.buildSuccess("");
    }
}
